<%@page import="com.carrental.entity.User"%>
<%@page import="java.util.List"%>
<%@page import="com.carrental.service.UserService"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>用户列表</title>
<style>
	*{
		margin: 0;
		padding: 0;
	}
	
	html,body{
		width: 100%;
		height: 100%;
		background-color: #f2f2f2;
	}
	
	.head{
		width: 100%;
		height: 50px;
		line-height: 50px;
		background-color: #FA8258;
		color: #ffffff;
	}
	.head-content{
		width: 900px;
		margin: auto;
	}
	.head-content h2{
		float: left;
		margin-right: 10px;
	}
	.head-content a{
		float: left;
		margin-right: 10px;
	}
	.main{
		width: 100%;
	}
	.main-content{
		padding: 20px;
		width: 900px;
		margin: auto;
		background: #ffffff;
	}
	
	
	table{
		width: 100%;
		text-align: center;
	}
	table tr{
		height: 50px;
	}
	
	.select-button{
		width: 100px;
		height: 30px;
	}
</style>
</head>
<body>
	<div class="head">
		<div class="head-content">
			<h2>汽车租赁网后台管理</h2>
			<a href="admin.jsp">首页</a>
			<a href="adminCarRentalList.jsp">订单管理</a>
			<a href="adminUserList.jsp">用户管理</a>
			<a href="LogoutServlet">退出</a>
		</div>
	</div>
	<div class="main">
		<div class="main-content">
			<table>
				<thead>
					<tr>
						<th>用户名</th>
						<th>手机号</th>
						<th>创建时间</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
					<%
						UserService userService = new UserService();
						List<User> users = userService.selectAll();
						
						for (User user : users) {
							out.print("<tr>");
							
							out.print("<td>" + user.getUsername() + "</td>");
							out.print("<td>" + user.getPhone() + "</td>");
							out.print("<td>" + user.getCreateDatetime() + "</td>");
							out.print("<td><a href='UserDeleteSerlvet?username=" + user.getUsername() + "'>删除</a></td>");
							
							out.print("</tr>");
						}
						
					%>
				</tbody>
			</table>
		</div>
	</div>
</body>
</html>